﻿using System;
using System.Collections.Generic;
using System.Data.Common;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//using TjZheng.MySql;
using TjZheng.Framework;
using System.ComponentModel;
using System.Reflection;
using System.Diagnostics;
using System.Text.RegularExpressions;
using System.IO;
using TjZheng.Logging;
using NLog.Targets;
using TjZheng.Base;
using NLog.Config;
using NLog;
using TjZheng.MemCached;
using TjZheng.Power.Business;
using TjZheng.Power.DataEntity;
using TjZheng.Test.Business;
using TjZheng.Test.DataEntity;
using System.Threading;
using System.Net;
using TjZheng.Cache;
using CJAtech.BBS.Business;
using CJAtech.BBS.DataEntity;
using CJAtech.Weplatform.Business;
using System.Xml.Serialization;
using System.Linq.Expressions;
using TjZheng.Domain.Business;
using System.Collections;
using System.Data;
using HtmlAgilityPack;
using System.Collections.Concurrent;

namespace TjZheng.Test.ConsoleApplication
{
    class Program
    {
        public class Class1 { }
        public class DerivedC1 : Class1 { }
        public class DerivedC2 : DerivedC1 { }

        //private static Logger logger = LogManager.GetCurrentClassLogger();
        static void Main(string[] args)
        {
            #region 框架测试
            Console.Read();
            Console.Read();

            Console.WriteLine(typeof(ArticleInfo));

            //Class1 myClass = new Class1();
            //DerivedC2 myDClass = new DerivedC2();
            //Type myClassType = myClass.GetType();
            //Type myDClassType = myDClass.GetType();

            //// Returns true:
            //Console.WriteLine("myDClass subclass of myClass: {0}", myDClassType.IsSubclassOf(myClassType));
            //Console.ReadLine();
            ////var objList = typeof(NullModel).GetProperty("Name").GetCustomAttributes<NonDBFieldAttribute>().ToList();

            Console.Read();
            //DateTime dateTime;
            //DateTime.TryParse("", out dateTime);
            //Console.WriteLine(dateTime == DateTime.MinValue);
            //Console.WriteLine(Convert.ToDateTime(""));

            //ConcurrentQueue<int> objConcurrentQueue = new ConcurrentQueue<int>();
            //for (int i = 1; i <= 50; i++)
            //{
            //    objConcurrentQueue.Enqueue(i);
            //}
            //int j = 0;
            //while (objConcurrentQueue.TryDequeue(out j))
            //{
            //    Console.WriteLine(j);
            //    Console.WriteLine(objConcurrentQueue.Count);
            //}

            //HtmlWeb objHtmlWeb = new HtmlWeb();
            //objHtmlWeb.OverrideEncoding = Encoding.GetEncoding("gb2312");
            //HtmlDocument objHtmlDocument = objHtmlWeb.Load("http://www.5442.com/meinv/20150924/27798_29.html");
            ////Console.WriteLine(objHtmlWeb.StatusCode);
            ////Console.WriteLine(objHtmlDocument.DocumentNode.SelectSingleNode("//title").InnerText);
            //HtmlNode objPageHtmlNode = objHtmlDocument.GetElementbyId("aplist");
            ////Console.WriteLine(objPageHtmlNode.InnerHtml);
            ////Console.WriteLine(objPageHtmlNode.SelectNodes("//div/ul/li") != null);
            //var objPageHtmlNodeCollection = objPageHtmlNode.SelectNodes("//div[@id='aplist']/ul/li");
            //Console.WriteLine(objPageHtmlNodeCollection.First().InnerText.MatchValue(@"\d+",RegexOptions.None));
            //Console.WriteLine(objPageHtmlNodeCollection.First().InnerText);
            //foreach (var obj in objPageHtmlNodeCollection)
            //{
            //    Console.WriteLine(obj.InnerHtml);
            //}
            //HtmlNode objHtmlNode = objHtmlDocument.GetElementbyId("contents");
            //var objHtmlNodeCollection = objHtmlNode.SelectNodes("//p/a/img");
            //foreach (var obj in objHtmlNodeCollection)
            //{
            //    Console.WriteLine(obj.GetAttributeValue("src", ""));
            //}
            //Console.WriteLine(objHtmlNode.InnerHtml);
            //TestHttp();
            //TestHttpAsync();

            //string str = "JsonOne";
            //str = str.Replace("Json", null);
            //Console.WriteLine(str);
            //Console.Read();
            //BizPowerInfo objBizPowerInfo = new BizPowerInfo();
            ////var objList = objBizPowerInfo.GetList("", "Id desc");
            //var objList = objBizPowerInfo.GetList("PowerName like @PowerName", new { PowerName = "%评论%" },"Id desc");
            //Console.Read();
            //var thread = Thread.CurrentThread;
            //Console.Read();

            //BizPowerInfo objBizPowerInfo = new BizPowerInfo();
            ////var objList = objBizPowerInfo.GetList("", "Id desc");
            //var objList = objBizPowerInfo.GetList("PowerName like @PowerName", new { PowerName = "%评论%" },"Id desc");
            //Console.Read();
            //object obj = null;
            //Console.WriteLine(obj.GetHashCode());

            //NullModel objNullModel1 = new NullModel
            //{
            //    Name = "NullModel",
            //    Age = 1
            //};
            //NullModel objNullModel2 = new NullModel
            //{
            //    Name = "NullModel",
            //    Age = 1
            //};
            //object obj1 = new { i1 = 1, i2 = 2, s1 = "s1", NullModel = objNullModel1 };
            //object obj2 = new { i1 = 1, i2 = 2, s1 = "s1", NullModel = objNullModel2 };
            //Console.WriteLine(obj1.GetHashCode());
            //Console.WriteLine(obj2.GetHashCode());

            //NullModel objNullModel1 = new NullModel
            //{
            //    Name = "NullModel",
            //    Age = 1
            //};
            //object obj1 = new { i1 = 1, i2 = 2, s1 = "s1", NullModel = objNullModel1 };
            //object obj2 = new { i1 = 1, i2 = 2, s1 = "s1", NullModel = objNullModel1 };
            //Console.WriteLine(obj1.GetHashCode());
            //Console.WriteLine(obj2.GetHashCode());

            //object obj1 = new { i1 = 1, i2 = 2, s1 = "s1" };
            //object obj2 = new { i1 = 1, i2 = 2, s1 = "s1" };
            //Console.WriteLine(obj1.GetHashCode());
            //Console.WriteLine(obj2.GetHashCode());

            //string s1 = "string";
            //string s2 = "string";
            //Console.WriteLine(s1.GetHashCode());
            //Console.WriteLine(s2.GetHashCode());

            //NullModel objNullModel1 = new NullModel 
            //{
            //    Name = "NullModel",
            //    Age=1
            //};
            //NullModel objNullModel2 = new NullModel
            //{
            //    Name = "NullModel",
            //    Age = 1
            //};
            //Console.WriteLine(objNullModel1.GetHashCode());
            //Console.WriteLine(objNullModel2.GetHashCode());

            //var obj1 = EncryptConnectionHelper.GetConnectionStringElement("TjZheng.News.ConnectionString");
            //Console.WriteLine(obj1.GetHashCode());
            //var obj2 = EncryptConnectionHelper.GetConnectionStringElement("TjZheng.News.ConnectionString");
            //Console.WriteLine(obj2.GetHashCode());

            //var obj = EncryptConnectionHelper.GetConnectionStringElement("TjZheng.News.ConnectionString");
            //Console.WriteLine(obj.GetHashCode());
            //obj = EncryptConnectionHelper.GetConnectionStringElement("TjZheng.News.ConnectionString");
            //Console.WriteLine(obj.GetHashCode());
            //Console.ReadKey();
            //obj = EncryptConnectionHelper.GetConnectionStringElement("TjZheng.News.ConnectionString");
            //Console.WriteLine(obj.GetHashCode());
            //Console.ReadKey();
            //obj = EncryptConnectionHelper.GetConnectionStringElement("TjZheng.News.ConnectionString");
            //Console.WriteLine(obj.GetHashCode());
            //Console.Read();

            //BizBase objBizBase = new BizBase();
            //ApiContext objApiContext = objBizBase.CreateApiContext("SqlApi", "ApiGroup_Demo1", "TjZheng_Demo2", new { ArticleId = 2 }, new { DataParam2 = "GL" });

            //ApiContext objApiContext = objBizBase.CreateApiContext("SqlApi", "ApiGroup_Demo1", "TjZheng_Demo3", new { ArticleId = 1 });
            //var objRecord = objBizBase.GetRecord("SqlApi", "ApiGroup_Demo1", "TjZheng_Demo3", new { Id = 1 });
            //var objRecord = objBizBase.GetRecordCache("", TimeSpan.FromMinutes(5), "SqlApi", "ApiGroup_Demo1", "TjZheng_Demo3", new { Id = 1 });
            //objRecord = objBizBase.GetRecordCache("", TimeSpan.FromMinutes(5), "SqlApi", "ApiGroup_Demo1", "TjZheng_Demo3", new { Id = 1 });
            //string cacheKey = objBizBase.CreateCacheKey("SqlApi" + "ApiGroup_Demo1" + "TjZheng_Demo3", "GetRecordCache", TimeSpan.FromMinutes(5), new { Id = 1 });
            //objBizBase.DeleteCache("", "SqlApi", "ApiGroup_Demo1", cacheKey);
            //objRecord = objBizBase.GetRecordCache("", TimeSpan.FromMinutes(5), "SqlApi", "ApiGroup_Demo1", "TjZheng_Demo3", new { Id = 1 });
            //objRecord = objBizBase.GetRecordCache("", TimeSpan.FromMinutes(5), "SqlApi", "ApiGroup_Demo1", "TjZheng_Demo3", new { Id = 1 });
            //objBizBase.DeleteDependentCache("", "SqlApi", "ApiGroup_Demo1");
            //objRecord = objBizBase.GetRecordCache("", TimeSpan.FromMinutes(5), "SqlApi", "ApiGroup_Demo1", "TjZheng_Demo3", new { Id = 1 });
            //objRecord = objBizBase.GetRecordCache("", TimeSpan.FromMinutes(5), "SqlApi", "ApiGroup_Demo1", "TjZheng_Demo3", new { Id = 1 });
            //Console.WriteLine(objRecord.JsonSerialize());
            //var objPowerInfo = objBizBase.GetRecord<PowerInfo>("SqlApi", "ApiGroup_Demo1", "TjZheng_Demo3", new { Id = 1 });
            //for (int i = 0; i < 100; i++)
            //{
            //    var objDataRow = objBizBase.ExecuteDataRow("SqlApi", "ApiGroup_Demo1", "TjZheng_Demo4");
            //    Console.WriteLine(objDataRow.Table.Columns[0] + "|" + objDataRow.Table.Columns[1]);
            //    Thread.Sleep(1000);
            //}

            //Console.Read();

            //var objXmlDocument = ConfigHelper.GetValue("SqlApi", "SqlConfig").CreateXmlDocument();
            //Console.WriteLine(objXmlDocument.DocumentElement.Attributes["DbType"].Value);

            //var objXmlNodeList = objXmlDocument.SelectSingleNode("/ApiRoot/ApiGroup[@Id='ApiGroup_Demo2']/Api[@Id='TjZheng_Demo1']");
            //Console.WriteLine(objXmlNodeList.SelectSingleNode("Sql").InnerText);

            //var objXmlNodeList = objXmlDocument.SelectSingleNode("/ApiRoot/ApiGroup[1]/Api[@Id='TjZheng_Demo1']");
            //Console.WriteLine(objXmlNodeList.Attributes["ReturnType"].Value);
            //Console.WriteLine(objXmlNodeList.SelectSingleNode("Sql").InnerText);

            //var objXmlNodeList = objXmlDocument.SelectSingleNode("/ApiRoot/ApiGroup[@Id='ApiGroup_Demo2']");
            //var obj = objXmlNodeList.SelectSingleNode("/ApiRoot/ApiGroup/Api[@Id='TjZheng_Demo1']");
            //Console.WriteLine(obj.SelectSingleNode("Sql").InnerText);

            //SqlApi objSqlApi = ConfigHelper.GetValue("SqlApi", "SqlConfig").CreateXmlEntity<SqlApi>();
            //Console.WriteLine(objSqlApi.ConnectionStringName);
            //Console.ReadKey();
            //objSqlApi = ConfigHelper.GetValue("SqlApi", "SqlConfig").CreateXmlEntity<SqlApi>();
            //Console.WriteLine(objSqlApi.ConnectionStringName);

            //SqlApi objSqlApi = new SqlApi();
            //objSqlApi.ConnectionStringName = "TjZheng.Test.ConnectionString";
            //Console.WriteLine(objSqlApi.XmlsSerialize());

            //NullModel objNullModel = new NullModel
            //{
            //    Name = "NullName",
            //    Age = 26
            //};
            ////Console.WriteLine(objNullModel.XmlsSerialize());
            //string xml = objNullModel.XmlsSerialize();
            //objNullModel = xml.XmlDeserialize<NullModel>();
            //Console.WriteLine(objNullModel.Name);

            //BizGuidInfo objBizGuidInfo = new BizGuidInfo();
            ////List<GuidInfo> objList = objBizGuidInfo.GetList("GuidId in(@GuidIds)", "GuidIds".CreateSqlParameters("b7857609-81b9-41e5-a146-1ef30674a0b6"));

            ////GuidInfo objGuidInfo = objBizGuidInfo.GetRecord(Guid.Parse("9da9df27-5e92-43c9-ad60-2903f9adf4c9"));
            ////Console.WriteLine(objGuidInfo.GuidName);
            ////objGuidInfo.SetState(EntityStatus.Deleted);
            ////List<GuidInfo> objList = new List<GuidInfo> { objGuidInfo };
            ////objBizGuidInfo.Batch(objList);

            //List<GuidInfo> objList = objBizGuidInfo.GetListIn(("b63d2c4e-0266-4f64-9211-58d747fe1f7a"));
            //if (objList.IsNoNull())
            //{
            //    foreach (var objGuidInfo in objList)
            //    {
            //        objGuidInfo.SetState(EntityStatus.Deleted);
            //    }
            //    GuidInfo objNewGuidInfo = new GuidInfo { GuidId = Guid.NewGuid(), GuidName = "批量操作测试" };
            //    objNewGuidInfo.SetState(EntityStatus.Added);
            //    objList.Insert(0, objNewGuidInfo);
            //    objBizGuidInfo.Batch(objList);
            //}
            //Console.WriteLine(Guid.NewGuid());
            //Console.WriteLine(Guid.NewGuid());
            //Console.WriteLine(Guid.NewGuid());
            //Console.WriteLine(Guid.NewGuid());
            //Console.WriteLine(Guid.NewGuid());
            //Console.WriteLine(Guid.NewGuid());
            //Console.WriteLine(Guid.NewGuid());

            //Dictionary<string, string> dict = new Dictionary<string, string>();
            //dict["A"] = "a";
            //Console.WriteLine(dict["A"]);
            //Console.WriteLine(dict["a"]);

            //BizUserInfo objBizUserInfo = new BizUserInfo();
            //var objList = objBizUserInfo.GetListIn("1,2");
            //var objList = objBizUserInfo.GetListIn("1");
            Console.ReadKey();

            //var objUserList = objBizUserInfo.GetPageListCache("", 0, 10);
            //objUserList = objBizUserInfo.GetPageListCache("", 0, 10);
            //var objUserInfo = objBizUserInfo.GetRecordCache(1);
            //objUserInfo = objBizUserInfo.GetRecordCache(1);

            //Action action = new Action(() =>
            //{
            //    Console.WriteLine("A：" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            //    Thread.Sleep(5 * 1000);
            //    Console.WriteLine("运行A");
            //    Console.WriteLine("A：" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            //});
            //var objAsyncResult = action.BeginInvoke(new AsyncCallback((ar) => { Console.WriteLine(ar.AsyncState); }), "A执行完成");
            ////objAsyncResult.AsyncWaitHandle.WaitOne();
            ////action.EndInvoke(objAsyncResult);
            ////while (!objAsyncResult.IsCompleted)
            ////{
            ////    Console.WriteLine("*****");
            ////}
            //while (true)
            //{ 

            //}
            //Console.WriteLine("B：" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            //Console.WriteLine("运行B");
            //Console.WriteLine("B：" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            //Thread.Sleep(3 * 1000);
            ////"http://www.gao7.com/".CreateHttpGet();

            //Console.WriteLine("C：" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            //Console.WriteLine("运行C");
            //Console.WriteLine("C：" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));

            //Console.WriteLine("http://tjzheng.sso.com/api/values/1".CreateHttpDelete());
            //Console.WriteLine("http://tjzheng.sso.com/api/values/1".CreateHttpPutData(null, new { values = "values111" }));

            //BizArticleInfo objBizArticleInfo = new BizArticleInfo();
            //var objDataTable = objBizArticleInfo.GetPageDataTable(0, 10);
            //var objList = objDataTable.ToListDictionary();
            //Console.WriteLine(objList.JsonSerialize());

            //BizArticleInfo objBizArticleInfo = new BizArticleInfo();
            //var objDataTable = objBizArticleInfo.GetPageDataTable(0, 10);
            ////IEnumerator ienumerator= objDataTable.Columns.GetEnumerator();
            ////while (ienumerator.MoveNext())
            ////{
            ////    Console.WriteLine(ienumerator.Current);
            ////}
            ////foreach (DataRow dataRow in objDataTable.Rows)
            ////{ 

            ////}
            Console.Read();

            //string url = "http://bmbshrnew.fpowerglobal.com/api/common?API=UserInfoList&page=" + 1 + "&pagesize=" + 10 + "&param=" + "";
            //string url = "http://tjzheng.webapi.com/api/btnapi";
            //Console.Write(url.CreateHttpGet());

            //int page = 1, rows = 10;
            //string param = "";
            //string url = "http://bmbshrnew.fpowerglobal.com/api/common?API=UserInfoList&page=" + page + "&pagesize=" + rows + "&param=" + param;
            //var objHttpWebRequest = url.CreateHttpRequest(null, "", null, "text/html, application/xhtml+xml, */*");
            //objHttpWebRequest.Method = "Get";
            ////Console.WriteLine(objHttpWebRequest.GetHttpResponse(Encoding.UTF8));
            //var objDict = objHttpWebRequest.GetHttpResponse(Encoding.UTF8).JsonDeserialize<Dictionary<string, object>>();

            //object obj = null;
            //PageResult<object> objPageResult = new PageResult<object>
            //{
            //    pageIndex = page,
            //    pageSize = rows
            //};
            //if (!objDict.TryGetValue("ApiParamObj", out obj))
            //{
            //    LogHelper.WriteLog("获取奔驰用户接口结果未找到ApiParamObj属性", objDict.JsonSerialize());
            //}
            //var objResult = obj as ArrayList;

            //var objUsers = objResult[0] as ArrayList;
            //var objList = objUsers.ToArray().ToList();
            //var obj11 = objList[0] as Dictionary<string, object>;
            //var objCounts = objResult[1] as ArrayList;
            //var obj12 = (int)objCounts[0];
            //Console.Read();
            //objPageResult.rows = objUsers;
            //objPageResult.total = objCounts[0];

            //Person objPerson = "{Name:\"jack chen\"}".JsonDeserialize<Person>();
            //Console.WriteLine(objPerson.Name);

            //Person obj = new Person { Name = "jack",Data="Lin" };
            //string str = obj.Name;
            //object data = obj.Data;
            //obj.Name = "TTT"; 
            //obj.Data = "SSS";
            //Console.WriteLine(str);
            //Console.WriteLine(data);

            //Lazy<Person> LazyLogger = new Lazy<Person>(() => new Person { Name = "Jack" }, System.Threading.LazyThreadSafetyMode.ExecutionAndPublication);
            //Console.Read();
            //Console.WriteLine("打印Name");
            //Console.WriteLine(LazyLogger.Value.Name);

            //BizArticleInfo objBizArticleInfo = new BizArticleInfo("CJAtech.Benz.ConnectionString", "BM");
            //objBizArticleInfo.ExecuteTransation(() => 
            //{
            //    objBizArticleInfo.GetRecord(1);
            //});

            //BizCategoryInfo objBizCategoryInfo = new BizCategoryInfo("CJAtech.Benz.ConnectionString", "BM");
            //BizUploadLimit objBizUploadLimit = new BizUploadLimit();
            //objBizCategoryInfo.ExecuteTransation(() =>
            //{
            //    objBizUploadLimit.GetRecord(6);
            //    var objParent = objBizCategoryInfo.GetRecord(1);
            //});

            //string value = RegexHelper.MatchValue("http://7vzrt1.com2.z0.glb.qiniucdn.com/0010af2330fa4145a7c92842a1a3bcff", @"7vzrt1.com2.z0.glb.qiniucdn.com/(?<key>\w+)", "key");
            //Console.WriteLine(value);

            //foreach (var p in typeof(Chinese).GetProperties())
            //{
            //    Console.WriteLine(p.Name);
            //}

            //BizGuidInfo objBizGuidInfo = new BizGuidInfo();
            //GuidInfo objGuidInfo = new GuidInfo();
            //objGuidInfo.GuidId = Guid.NewGuid();
            //Console.WriteLine(objGuidInfo.GuidId);
            //objGuidInfo.GuidName = "主键可赋值";
            //objBizGuidInfo.Add(objGuidInfo);

            //Person objPerson = new Person { Name = "HanMeiMei", Age = 18 };
            //objPerson.PersonChild = new Person { Name = "XiaoMin", Age = 8 };
            //Dictionary<string, object> objDict = objPerson.JsonSerialize().JsonDeserialize<Dictionary<string, object>>();
            //Console.WriteLine(objDict["Name"]);
            //Console.WriteLine(objDict["PersonChild"]);

            //BizArticleInfo objBizArticleInfo = new BizArticleInfo();
            //objBizArticleInfo = new BizArticleInfo();

            //CJAtech.Hrms.Business.BizUserInfo objBizUserInfo = new CJAtech.Hrms.Business.BizUserInfo();

            //    foreach (var objUserInfo in objBizUserInfo.GetPageList(0, 10))
            //    {
            //        Console.WriteLine(objUserInfo.CardNO);
            //    }
            //try
            //{
            //}
            //catch (Exception ex)
            //{
            //    ConsoleHelper.WriteLineRed(ex);
            //}

            //CookieContainer objCookieContainer = new CookieContainer();
            //objCookieContainer.Add(new Cookie("SSOToken", "00246E01B8AA", "", "cjatech.bbs.com"));
            //objCookieContainer.Add(new Cookie("UserTicket", "6589E9096024E382D0379A14BD6C88E98716D09FAC385B271631F1F310F2A1738B884F047A028A5B21B81D6F7082FC5B533547AADB2A3D96B15BD781569789788BB089B82F22849DE61F2D2A47C6C32F845CA1C3641BCA67843B41D151454E4CE0893FE4EC6F6FFCAB68C99D941F911B54C1B713F6850F417C4C76360CFB3FEC4E5430CE8E38B7866C3890F1FEFC8ADCEB71B2762F2C15D2BFD5464F8E9B474C047656D3883DECD32F5B5D2F474BD6274EA3F505A7A7052CF6356DE312EFA7C72D0D1270F9878ACE05942A1441A2EB91D57F11DDFCDBE285AB18B76DFB291CB7A53E3D7566BB1D9D0531C20ACADAE3EE468B087C0DA939BDB6CB951D85BE81DCA005032E2E9AA68137EB6BD5245D3ED708352B1BCAB1AD932BDD4D2F636E4CD543A0CDD3E76026C1810265399425541F1D92F9AA9E437A648F72EDBAF5BEACBF2EA8D89CED42EAD552963B9A9DB125260ACA9EE55FF72BA7C4C8C246E20C6EEA48C49C9A7167A129A50AB014D094274EE22D55A7303C21817D4581621A3B31794C8D63F4034EA26BBFD8DF37E2B3140065F50C13C12952A4F953D8219B87341CCBCAE9B8E22A74647B0DCE22BAAD348E01412EA9506CA96D50E5806DB8B6974699BE345EB45633A03D18A6E35EEF64930D0EAC5D73D1C8F23B5B857EA649DA0A960335160561D84DEDA9506D3471C47D219AE24283EC3BC94F6535ED64B7D512D20347E1C23E123D14AA45B7E53B6D642C0C197E06497F4FF6DB4AA14CFF87F48B472A8662729172EF71E84BB52500C684005F8283897F0C60199E78BDA11F6E94D64EE34F67E4072E840F3E3A33CE8BA333ACD94DBDC5F7DBF99511B319BB6E3ED33429EA9850F0C277E7626E3825F61513B40531997D34EF4F80DB5449946E783B5FB57CC7BDADDA7E3840A746B9D3EF188114CB615A6E2C52B19C6D15544C9F5E39DCDBE254814336572B184BE6C092A50F64955C4055B4CD85B5025B9BDBDA4319FCE8A8EFD091223438E88067A674D910C569B1BDCEA8E9726B97F1201129F4867677DD8499174ECD1A9FC8604DD3452F03846AD9BD71F2F6192E94ACA2523C4C133F1299864E76293076FEC2E634038F7202E9D26CF01D1417187DBE136EFBCE0A417F072C648EB0F7B540D7895CED3FC810A06AADCC6772DD720054E6B947CEA8BD0245C6CBCA27DC79A300C1667AD0EABB5AF8AF4BE370E54DB0EC20CBE90A6365AA63C598C95DAF0F6CCD18F81C5F6A32F1101952EA0AC10BA8496E117E0473DD26CB563ADFECE6E50E78E700842107AE24FF8058E346366C3FCDED14EB760C613ED852EF4BCA2B26387ED741F9F60A04907B881972EBD81F93278B7CDE1E0D4F421AB770AD6610573FAF05", "", "cjatech.bbs.com"));
            //objCookieContainer.Add(new Cookie("UserToken", "eyJVc2VyQWdlbnQiOiJNb3ppbGxhLzUuMCAoV2luZG93cyBOVCA2LjE7IFdPVzY0KSBBcHBsZVdlYktpdC81MzcuMzYgKEtIVE1MLCBsaWtlIEdlY2tvKSBDaHJvbWUvNDEuMC4yMjcyLjg5IFNhZmFyaS81MzcuMzYiLCJUaW1lU3RhbXAiOjYzNTY5MDI1MzE2NTc0MDMwNiwiU2VlZCI6NjMsIlRva2VuIjoiIn0=", "", "cjatech.bbs.com"));
            //string test = "http://cjatech.bbs.com/bbs/benz".CreateHttpGet(null, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.89 Safari/537.36", objCookieContainer);
            //Console.WriteLine(test);

            //Console.WriteLine();

            //Console.WriteLine("eyJVc2VyQWdlbnQiOiJNb3ppbGxhLzUuMCAoV2luZG93cyBOVCA2LjE7IFdPVzY0KSBBcHBsZVdlYktpdC81MzcuMzYgKEtIVE1MLCBsaWtlIEdlY2tvKSBDaHJvbWUvNDEuMC4yMjcyLjg5IFNhZmFyaS81MzcuMzYiLCJUaW1lU3RhbXAiOjYzNTY5MDI1MzE2NTc0MDMwNiwiU2VlZCI6NjMsIlRva2VuIjoiIn0=".DecodeBase64());

            ////string keyword_string = "SB|***|日你|日你大爷|优惠|Fuck";
            ////string[] keywords = keyword_string.Split('|');
            //string text = @"SB 陈雨 优惠 优 惠 優惠 優 惠   優     惠 F U C K fuck FuCk 毛爷爷";
            //string[] str = new string[] { "优惠", "ddffgfgfgh" };
            //Console.WriteLine(text.IsContainsBadWords(str));
            //str = text.SearchBadWords(str);
            //string result = text.ReplaceBadWords("优惠", "毛爷爷");
            //Console.WriteLine(result);
            ////string result = text.ReplaceBadWords((t, o, l) => { return "*"; }, "优惠","毛爷爷");
            //Console.ReadLine();

            //TestDomainPath();

            //object o = null;
            //var u = (UserInfo)o;

            //BizUser objBizUser = new BizUser();
            //var objUser = objBizUser.GetRecord("openid='ohVput5Qc6gpQqjoEA-NehpkK7IU'");
            //Console.WriteLine(objUser.Platformuserid.HasValue);

            //int? v = null;
            //Console.WriteLine("12345" + v);

            //Console.WriteLine(DateTime.Now.AddTicks(TimeSpan.FromHours(1).Ticks).ToString("yyyy-MM-dd HH:mm:ss"));

            //BizUser objBizUser = new BizUser();
            //var objUser = objBizUser.GetRecord("openid='oPvG-jkkNsTDnV_oplyO9JvKStGs'");
            ////objBizUser.GetRecordCache("openid='oPvG-jkkNsTDnV_oplyO9JvKStGs'");
            //Console.WriteLine(objUser.Nickname);

            //object obj = null;
            //var d = (int?)obj;
            //Console.WriteLine(d.HasValue);

            //BizCommentInfo objBizCommentInfo = new BizCommentInfo();
            //objBizCommentInfo.Add(new CommentInfo
            //{
            //    UserId = Guid.NewGuid().ToString(),
            //    NickName = "用户4",
            //    ObjectId = "3",
            //    Content = "我顶你妹啊！",
            //    IsAudit = 1
            //});
            //var obj = objBizCommentInfo.DbRepository.DbHelper.ExecuteScalar("select top 1 CommentId from BBS_CommentInfo_TB with(nolock) where CommentId>1000");

            //Console.WriteLine(Encoding.Default.GetBytes("abcd").Length);
            //Console.WriteLine(Encoding.Default.GetBytes("嘻嘻哈哈").Length);
            //Console.WriteLine(Encoding.Default.GetBytes("1234").Length);
            //Console.WriteLine(Encoding.Default.GetBytes("嘻嘻哈哈ab12").Length);

            //Console.WriteLine("94cbb582-b41a-49b1-96b9-06dd6ff6b0fa,94cbb582-b41a-49b1-96b9-06dd6ff6b0fa".ConvertVarcharString());

            //Guid objGuid = "94cbb582-b41a-49b1-96b9-06dd6ff6b0fa".ConvertTarget<Guid>();
            //Guid objGuid = Guid.Empty;
            //Console.WriteLine(objGuid);
            //Console.WriteLine("1".ConvertTarget<long>());
            //Console.WriteLine("1".ConvertTarget<int>());
            //Console.WriteLine(1.ConvertTarget<Weeks>());

            //Console.WriteLine(Guid.Parse("94cbb582-b41a-49b1-96b9-06dd6ff6b0fa"));

            //不能强制转换
            //Guid objGuid = ConverToTarget<Guid>("94cbb582-b41a-49b1-96b9-06dd6ff6b0fa");
            //Console.WriteLine(objGuid);

            //Console.WriteLine("22222" + Guid.NewGuid());

            //NLogger objNLogger = new NLogger("ExampleLog", @"D:\{0}.log");
            //objNLogger.WriteLog("记录了吗");

            //var objProperties = typeof(ZooEntity).GetProperties().Where(c => c.GetCustomAttribute(typeof(NonDBFieldAttribute)) == null).ToList();
            //foreach (var objProperty in objProperties)
            //{
            //    Console.WriteLine(objProperty.Name);
            //}

            //Console.WriteLine(0x2710L);

            //int result1 = DateTime.Now.ConvertToSecondStamp();
            ////int result2 = DateTime.Now.AddMinutes(1).ConvertToSecondStamp();
            //Console.WriteLine(result1);
            ////Console.WriteLine(result2);
            //Console.WriteLine(result1.ConvertSecondStampToDateTime().ToString("yyyy-MM-dd HH:mm:ss"));

            //DateTime objDateTime = DateTime.Now;
            //long result1 = objDateTime.ConvertToStamp();
            ////long result2 = objDateTime.AddMinutes(1).ConvertToStamp();
            //Console.WriteLine(result1);
            ////Console.WriteLine(result2);
            //Console.WriteLine(result1.ConvertStampToDateTime().ToString("yyyy-MM-dd HH:mm:ss"));

            //object test = 1;
            //Console.WriteLine((long)test);

            //for (int i = 0; i < 1000; i++)
            //{
            //    try
            //    {
            //        HttpHelper.CreateHttpGet("http://tjzheng.example.com/Jcrop/RemoteImageWithWatermark");
            //    }
            //    catch (Exception)
            //    {

            //    }
            //}

            //Console.WriteLine(HttpHelper.CreateHttpGet("http://tjzheng.example.com/http/get"));
            //Console.WriteLine(HttpHelper.CreateHttpGet("http://tjzheng.example.com/http/getjson"));

            //Console.WriteLine(HttpHelper.CreateHttpPostData("http://tjzheng.example.com/http/postdata", null));
            //Console.WriteLine(HttpHelper.CreateHttpPostData("http://tjzheng.example.com/http/postdata", new { data1 = "呵呵", data2 = "哈哈" }));
            //Console.WriteLine(HttpHelper.CreateHttpPostData("http://tjzheng.example.com/http/postdatajson", new { data1 = "呵呵", data2 = "哈哈" }));
            //Console.WriteLine(HttpHelper.CreateHttpPostJson("http://tjzheng.example.com/http/postjson", new InvokeResult { ResultMessage = "传递Json数据" }));
            //Console.WriteLine(HttpHelper.CreateHttpPostJson("http://tjzheng.example.com/http/postjsonjson", new InvokeResult { ResultMessage = "传递Json数据" }));
            //Console.WriteLine(HttpHelper.CreateHttpPostFile("http://tjzheng.example.com/http/postfile", new { photo = @"C:\Users\TJZH\Desktop\bzwx-heros-bg.png" }));
            //Console.WriteLine(HttpHelper.CreateHttpPostFile("http://tjzheng.example.com/http/postfilejson", new { photo = @"C:\Users\TJZH\Desktop\bzwx-heros-bg.png" }));

            //CookieContainer objCookieContainer = new CookieContainer();
            //Cookie objCookie = new Cookie("myCookie", "huang", "", "tjzheng.example.com");
            //objCookieContainer.Add(objCookie);
            //Console.WriteLine(HttpHelper.CreateHttpGet("http://tjzheng.example.com/http/withcookiejson", null, objCookieContainer));

            //BizUserInfo objBizUserInfo = new BizUserInfo();
            //objBizUserInfo.GetRecordCache("", 1);
            //objBizUserInfo.DeleteDependentCache("");
            //objBizUserInfo.GetRecordCache("", 1);


            //Console.WriteLine(string.Join(",", 1, 2, 3, 4, 5));

            //List<ZooEntity> objList = new List<ZooEntity> 
            //{ 
            //    new ZooEntity{zoo="1",bar="1",baz="1"},
            //    new ZooEntity{zoo="1",bar="1",baz="1"}
            //};
            //Console.WriteLine(objList.Distinct().Count());

            //BizUserInfo objBizUserInfo = new BizUserInfo();
            //objBizUserInfo.DeleteIDCache(3);

            //BizUserInfo objBizUserInfo = new BizUserInfo();
            //var objUserInfoList = objBizUserInfo.GetListCache("", "Id=1");
            //objUserInfoList = objBizUserInfo.GetListCache("", "Id=1");
            //objBizUserInfo.DeleteCache("", objBizUserInfo.CreateCacheKey("Id=1", "GetListCache"));
            //objUserInfoList = objBizUserInfo.GetListCache("", "Id=1");


            //BizUserInfo objBizUserInfo = new BizUserInfo();
            //var objUserInfoList = objBizUserInfo.GetListCache("", "Id=1");
            //var objUserInfo = objBizUserInfo.GetRecordCache("", "ID=1");
            //objBizUserInfo.DeleteDependentCache("");
            //objUserInfo = objBizUserInfo.GetRecordCache("", "ID=1");
            //objUserInfoList = objBizUserInfo.GetListCache("", "Id=1");

            //BizUserInfo objBizUserInfo = new BizUserInfo();
            //var objUserInfo = objBizUserInfo.GetRecordCache("", "ID=1");
            //objBizUserInfo.DeleteDependentCache("");
            //objUserInfo = objBizUserInfo.GetRecordCache("", "ID=1");

            //BizUserInfo objBizUserInfo = new BizUserInfo();
            //var objUserInfo = objBizUserInfo.GetRecordCache(1);
            //objBizUserInfo.DeleteIDCache(1); 
            //objUserInfo = objBizUserInfo.GetRecordCache(1);


            Console.Read();

            //TimeSpan objTimeSpan = TimeSpan.FromHours(10);
            //Console.WriteLine(objTimeSpan);

            //BizTest1 objBizTest1 = new BizTest1();
            //Test1 objTest1 = new Test1 { Name = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") };
            //objBizTest1.ExecuteTransation(() =>
            //{
            //    objTest1.Id = objBizTest1.Add(objTest1);
            //    Console.WriteLine(objTest1.Id + "：" + objTest1.Name);
            //    Thread.Sleep(1000 * 10);

            //    BizTest2 objBizTest2 = new BizTest2();
            //    Test2 objTest2 = new Test2 { Name = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") };
            //    objTest2.Id = objBizTest2.Add(objTest2);
            //    Console.WriteLine(objTest2.Id + "：" + objTest2.Name);
            //    Thread.Sleep(1000 * 10);
            //    throw new Exception("事务回滚");
            //});

            //string str = "" + 1 + 2;
            //Console.WriteLine(str);

            //BizUserInfo objBizUserInfo = new BizUserInfo();
            //objBizUserInfo.DeleteDependentCache("");
            //string cacheKey = "Id=1" + typeof(UserInfo).GetProperties().Select(c => c.Name).JoinString(",");
            //objBizUserInfo.DeleteCache("", cacheKey);
            //var objUserInfoList = objBizUserInfo.GetListCache("", "Id=1");
            //Console.WriteLine(objUserInfoList.Count);
            //MemCache objMemCache = new MemCache();
            //objMemCache.SetCache("tjzheng", "郑廷建", new TimeSpan(0, 3, 0));
            //object obj1 = objMemCache.GetCache("tjzheng");
            //Console.WriteLine(obj1);
            //objMemCache.DeleteCache("tjzheng");
            //obj1 = objMemCache.GetCache("tjzheng");
            //Console.WriteLine(obj1);

            //Person objPerson = new Person();
            //objPerson.Age = 0;
            //objPerson.Name = "测试";
            //List<Person> list = new List<Person>();
            //for (int i = 0; i < 5; i++)
            //{
            //    objPerson.Age++;
            //    list.Add(objPerson);
            //}
            //Console.WriteLine(list[3].Age);
            //Console.WriteLine(Guid.NewGuid());

            //NLogDBTest();

            //LogHelper.ConsoleLog("测试");
            //LogHelper.WriteLog("测试啊测试啊测试啊");

            //string directory = Path.GetDirectoryName("ftp://127.0.0.1/My/MyChild/科技频道.png");
            //Console.WriteLine(directory);
            //Console.WriteLine(directory.Substring(0, directory.LastIndexOf("\\")));

            //using (FtpConnection ftp = new FtpConnection("127.0.0.1", "tjzheng", "5201314.."))
            //{

            //    ftp.Open(); /* Open the FTP connection */
            //    ftp.Login(); /* Login using previously provided credentials */

            //    if (ftp.DirectoryExists("/incoming")) /* check that a directory exists */
            //        ftp.SetCurrentDirectory("/incoming"); /* change current directory */

            //    if (ftp.FileExists("/incoming/file.txt"))  /* check that a file exists */
            //        ftp.GetFile("/incoming/file.txt", false); /* download /incoming/file.txt as file.txt to current executing directory, overwrite if it exists */

            //    //do some processing

            //    try
            //    {
            //        ftp.SetCurrentDirectory("/outgoing");
            //        ftp.PutFile(@"d:\svn.txt", "file.txt"); /* upload c:\localfile.txt to the current ftp directory as file.txt */
            //    }
            //    catch (FtpException e)
            //    {
            //        Console.WriteLine(String.Format("FTP Error: {0} {1}", e.ErrorCode, e.Message));
            //    }

            //    foreach (var dir in ftp.GetDirectories("/incoming/processed"))
            //    {
            //        Console.WriteLine(dir.Name);
            //        Console.WriteLine(dir.CreationTime);
            //        foreach (var file in dir.GetFiles())
            //        {
            //            Console.WriteLine(file.Name);
            //            Console.WriteLine(file.LastAccessTime);
            //        }
            //    }
            //}

            //string input = "<div style=\"display: none\"><script src='http://w.cnzz.com/c.php?id=1252910947' language='JavaScript'></script><script src='http://w.cnzz.com/c.php?id=34545' language='JavaScript'></script></div>";
            //string patten = "src=['|\"]{1}(?<src>[^'|\"]+)['|\"]{1}";
            //var objResult = RegexHelper.Matches(input, patten, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
            //foreach (Match obj in objResult)
            //{
            //    Console.WriteLine(obj.Groups["src"]);
            //}
            //TestGoTo();

            //TestAbstractChild objTestAbstractChild = new TestAbstractChild("sss");

            //BizAppInfo objBizAppInfo = new BizAppInfo();
            //var objAppInfo = objBizAppInfo.GetDataSet("Id=@Id", "Id".CreateSqlParameters(1), "", "");
            //TestAbstract.Test();

            //MySqlHelper objMySqlHelper = new MySqlHelper("TjZheng.MySqlTest");
            //var objDataTable = objMySqlHelper.ExecuteDataTable("SELECT Id,TestString,TestBool,TesInt,TestDouble,TestDate,TestImage,TestImages,TestArea,TestContent FROM Cms_TemplateTest_TB WHERE TesInt=?TesInt ORDER BY Id LIMIT 0, 10;", "TesInt".CreateMySqlParameters(3));
            //Console.Read();

            //DatabaseTarget target = new DatabaseTarget();
            //DatabaseParameterInfo param;

            //target.DBProvider = "mssql";
            //target.DBHost = "TJZH-PC";
            //target.DBUserName = "tjzheng";
            //target.DBPassword = "5201314..";
            //target.DBDatabase = "TjZheng_Logging";
            //target.ConnectionString = EncryptConnectionHelper.ConnectionString("TjZheng.Logging");
            //target.CommandText = "insert into Cms_LogTable_TB(time_stamp,level,logger,message) values(@time_stamp, @level, @logger, @message);";

            //param = new DatabaseParameterInfo();
            //param.Name = "@time_stamp";
            //param.Layout = "${date}";
            //target.Parameters.Add(param);

            //param = new DatabaseParameterInfo();
            //param.Name = "@level";
            //param.Layout = "${level}";
            //target.Parameters.Add(param);

            //param = new DatabaseParameterInfo();
            //param.Name = "@logger";
            ////param.Layout = "${logger}";
            //param.Layout = "${event-context:item=LogName}";
            //target.Parameters.Add(param);

            //param = new DatabaseParameterInfo();
            //param.Name = "@message";
            //param.Layout = "${message}";
            //target.Parameters.Add(param);

            //////NLog.Config.SimpleConfigurator.ConfigureForTargetLogging(target, LogLevel.Debug);
            //LoggingConfiguration config = new LoggingConfiguration();
            //config.AddTarget("database", target);
            //LoggingRule rule3 = new LoggingRule("*", LogLevel.Debug, target);
            //config.LoggingRules.Add(rule3);
            //LogManager.Configuration = config;
            //Logger logger = LogManager.GetLogger("Example");

            //LogEventInfo ei = new LogEventInfo(LogLevel.Info, "", "log message");
            //ei.Properties["LogName"] = "LogName";
            //logger.Log(ei);

            //logger.Debug("log message");


            // Step 1. Create configuration object 

            //LoggingConfiguration config = new LoggingConfiguration();

            // Step 2. Create targets and add them to the configuration 

            //ColoredConsoleTarget consoleTarget = new ColoredConsoleTarget();
            //config.AddTarget("console", consoleTarget);

            //FileTarget fileTarget = new FileTarget();
            //config.AddTarget("file", fileTarget);

            //DatabaseTarget databaseTarget = new DatabaseTarget();

            //databaseTarget.DBProvider = "mssql";
            //databaseTarget.DBHost = "TJZH-PC";
            //databaseTarget.DBUserName = "tjzheng";
            //databaseTarget.DBPassword = "5201314..";
            //databaseTarget.DBDatabase = "MyProject";

            //databaseTarget.ConnectionString = EncryptConnectionHelper.ConnectionString("MyProject.Domain");
            //databaseTarget.CommandText = "insert into Cms_LogInfo_TB ([LogName], [ModuleType], [LogType], [ServerIP], [ClientIP], [UserName], [LastRequestUrl], [RequestUrl], [LogTitle], [LogContent], [LogDate]) values (@LogName, @ModuleType, @LogType, @ServerIP, @ClientIP, @UserName, @LastRequestUrl, @RequestUrl, @LogTitle, @LogContent, @LogDate)";
            //databaseTarget.Parameters.Add(new DatabaseParameterInfo("@LogName", "${event-context:item=LogName}"));
            //databaseTarget.Parameters.Add(new DatabaseParameterInfo("@ModuleType", "${event-context:item=ModuleType}"));
            //databaseTarget.Parameters.Add(new DatabaseParameterInfo("@LogType", "${event-context:item=LogType}"));
            //databaseTarget.Parameters.Add(new DatabaseParameterInfo("@ServerIP", "${event-context:item=ServerIP}"));
            //databaseTarget.Parameters.Add(new DatabaseParameterInfo("@UserName", "${event-context:item=UserName}"));
            //databaseTarget.Parameters.Add(new DatabaseParameterInfo("@LastRequestUrl", "${event-context:item=LastRequestUrl}"));
            //databaseTarget.Parameters.Add(new DatabaseParameterInfo("@RequestUrl", "${event-context:item=RequestUrl}"));
            //databaseTarget.Parameters.Add(new DatabaseParameterInfo("@LogTitle", "${event-context:item=LogTitle}"));
            //databaseTarget.Parameters.Add(new DatabaseParameterInfo("@LogContent", "${event-context:item=LogContent}"));
            //databaseTarget.Parameters.Add(new DatabaseParameterInfo("@LogDate", "${event-context:item=LogDate}"));
            ////config.AddTarget("database", databaseTarget);
            //NLog.Config.SimpleConfigurator.ConfigureForTargetLogging(databaseTarget, LogLevel.Debug);


            // Step 3. Set target properties 

            //consoleTarget.Layout = "${date:format=HH\\:MM\\:ss} ${logger} ${message}\r\n${exception:format=stacktrace}";
            //fileTarget.FileName = "${basedir}/file.txt";
            //fileTarget.Layout = "${message}";


            // Step 4. Define rules 

            //LoggingRule rule1 = new LoggingRule("*", LogLevel.Debug, consoleTarget);
            //config.LoggingRules.Add(rule1);

            //LoggingRule rule2 = new LoggingRule("*", LogLevel.Debug, fileTarget);
            //config.LoggingRules.Add(rule2);

            //LoggingRule rule3 = new LoggingRule("*", LogLevel.Debug, databaseTarget);
            //config.LoggingRules.Add(rule3);

            // Step 5. Activate the configuration 

            //LogManager.Configuration = config;

            // Example usage 

            //Logger logger = LogManager.GetLogger("Example");
            //logger.Trace("trace log message");
            //logger.Debug("debug log message");
            //logger.Info("info log message");
            //logger.Warn("warn log message");
            //logger.Error("error log message");
            //logger.Fatal("fatal log message");
            //try
            //{
            //    string test = string.Format("}{{}");
            //}
            //catch (Exception ex)
            //{
            //    logger.Info(ex.Message, ex);
            //}


            //LogEventInfo ei = new LogEventInfo(LogLevel.Info, "", "");
            //ei.Properties["LogName"] = "LogName";
            //ei.Properties["ModuleType"] = "ModuleType";
            //ei.Properties["LogType"] = 0;
            //ei.Properties["ServerIP"] = "127.0.0.1";
            //ei.Properties["ClientIP"] = "127.0.0.1";
            //ei.Properties["UserName"] = "UserName";
            //ei.Properties["LastRequestUrl"] = "LastRequestUrl";
            //ei.Properties["RequestUrl"] = "RequestUrl";
            //ei.Properties["LogTitle"] = "LogTitle";
            //ei.Properties["LogContent"] = "LogContent";
            //ei.Properties["LogDate"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            //logger.Log(ei);
            //Console.WriteLine("运行成功");

            //logger.Trace("Hello World!");
            //logger.Debug("Hello World!");
            //logger.Info("Hello World!");
            //logger.Warn("Hello World!");
            //logger.Error("Hello World!");
            //logger.Fatal("Hello World!");
            //WriteLog(LogLevel.Error, "Test");

            //logger.Trace("This is a Trace message");
            //logger.Debug("This is a Debug message");
            //logger.Info("This is an Info message");
            //A();
            //logger.Warn("This is a Warn message");
            //logger.Error("This is an Error message");
            //logger.Fatal("This is a Fatal error message"); 

            ////得到主机名
            //string name = Dns.GetHostName();
            //Console.WriteLine("主机名字：{0}", name);

            //IPHostEntry me = Dns.GetHostByName(name);

            ////输出得到的IP
            //foreach (IPAddress ip in me.AddressList)
            //{
            //    Console.WriteLine("IP  地址：{0}", ip.ToString());
            //}


            //object values = new { id = "1111", name = "form" };
            //IDictionary<string, object> dictionary = new Dictionary<string, object>();
            //if (values != null)
            //{
            //    foreach (PropertyDescriptor descriptor in TypeDescriptor.GetProperties(values))
            //    {
            //        object obj2 = descriptor.GetValue(values);
            //        dictionary.Add(descriptor.Name, obj2);
            //    }
            //}
            //Console.WriteLine(dictionary["name"]);

            //string platforms = "android,ios,other";
            //Console.WriteLine(platforms.Contains(null));

            //string test = "222222";
            //test.ConvertLong();

            //string tags = "图文,视频";
            //Console.WriteLine(tags.CreateTagCondition());

            //string objContent = "海岛奇兵顶顶顶战争总动ddd员抽奖顶顶顶安卓各回各家越狱斯蒂芬礼包";
            //List<string> objReplaces = new List<string> { "海岛奇兵", "战争总动员抽奖", "礼包", "安卓", "越狱" };
            //string pattens = string.Join("|", objReplaces);
            //objContent = objContent.Replace(pattens, "", RegexOptions.IgnoreCase);
            //Console.WriteLine(objContent);

            //Console.WriteLine(typeof(DalAccessesSectionHelper).Name);

            //string objAssembly = DalAccessesSectionHelper.Assembly("MyProject.Domain.Repository");
            //Console.WriteLine(objAssembly);

            ////string objDbType = DalAccessesSectionHelper.DbType("MyProject.Domain.Repository");
            ////Console.WriteLine(objDbType);

            //string objDbType = DalAccessesSectionHelper.DbType("MyProject.Test.Repository");
            //Console.WriteLine(objDbType);

            //TestNa();
            //string str = TestNameSpace.GetMethodInfo();
            //Console.WriteLine(str);

            //string assembly = typeof(MD5Helper).Assembly.GetName().Name;
            //Console.WriteLine(assembly);
            //string MyProjectConnectionString = EncryptConnectionHelper.ConnectionString("MyProjectConnectionString");
            //Console.WriteLine(MyProjectConnectionString);
            //string man = "SERVER=192.168.0.118;Port=3306;Database=gao7manage;Uid=gao7test;Pwd=gao7test;persist security info=True;Allow User Variables=True;Charset=utf8;";
            //string Handsome1 = man.EncryptDES("jqmhtjtz");
            //Console.WriteLine(Handsome1);
            //Console.WriteLine(Handsome1.DecryptDES("jqmhtjtz"));
            //string Handsome2 = man.EncryptBase64DES("jqmhtjtz");
            //Console.WriteLine(Handsome2);
            //Console.WriteLine(Handsome2.DecryptBase64DES("jqmhtjtz"));

            //string s = Regex.Replace("年龄=20", @"(.+)=(.+)", "$2是$1");
            //Console.WriteLine(s);

            //Task.Factory.StartNew(() => 
            //{
            //    System.Threading.Thread.Sleep(5000);
            //}).ContinueWith(task => 
            //{
            //    Console.WriteLine("我是异步，回调");
            //});
            //Console.WriteLine(Guid.NewGuid());


            //QueryTextBox objQueryTextBox = new QueryTextBox("Query", "Name")
            //{
            //    Id = "QueryID",
            //    QueryTitle = "测试",
            //    QueryValue = "查询值",
            //    IsRequired = true,
            //    Width = 400
            //};
            //Console.WriteLine(objQueryTextBox);
            //Console.WriteLine(objQueryTextBox.GetCondition());

            Console.Read();

            //string result = "http://myproject.example.mvc.com/Home/PostJson".GetPageSource(new FooEntity { foo = "foo", zoo = "zoo", bar = "bar", baz = "baz", zooEntity = new ZooEntity { zoo = "zooEntity.zoo", bar = "zooEntity.bar", baz = "zooEntity.baz" } }.JsonSerialize());
            //Console.WriteLine(result);

            //XDocument objXDocument = XDocument.Load(@"D:\XDocument.xml");
            //var result= HttpUtility.HtmlEncode(objXDocument);
            //Console.WriteLine(result);


            //NameValueCollection objNameValue = new NameValueCollection();
            //objNameValue["1"] = "1";
            //objNameValue["1"] = "111";
            //objNameValue["1"] = "11";
            //objNameValue.Add("1","4444444");
            //Console.WriteLine(objNameValue["1"].Length);
            //Console.WriteLine(objNameValue["1"]);

            //PersonSection person = ConfigHelper.GetSection("Person") as PersonSection;
            //Console.WriteLine(person.Name);
            //Console.WriteLine(person.Sex);
            //Console.WriteLine(person.Dog.Name);
            //Console.Read();
            //string urlPathAndQuery = "www.gao7.com/sy/1";
            //Console.Write(System.IO.Path.GetExtension(urlPathAndQuery));
            //Console.Read();
            //Console.Write("dd\r\n dd");
            //Chinese objChinese = new Chinese();
            //Person objPerson = (Person)objChinese;
            //objPerson = (Chinese)objPerson;
            //if (objPerson.PersonChild is Chinese)
            //{
            //    Console.Write("没报错");
            //}

            //SoftrCategories objSoftrCategories = new SoftrCategories();
            //var obj = (SoftrCategoriesExt)objSoftrCategories;


            Console.Read();

            //var person = TryFunc(() =>
            //{
            //    Person p = null;
            //    string name = p.Name;
            //    return p;
            //});

            //BizAppInfo _app = new BizAppInfo("_Test");

            //var list = new List<AppInfo>();
            //for (int i = 0; i < 3; i++)
            //{
            //    AppInfo model = new AppInfo();
            //    model.GenerateNewIdentity();
            //    model.Name = i + "=主表=" + i;
            //    model.SetState(EntityStatus.Added);
            //    list.Add(model);
            //}


            //MSSqlHelper<AppInfo, long> appsql = new MSSqlAppInfo("_Test");
            //var dataTable = appsql.ExecuteQuerySql("select * from " + appsql._TableName);
            //var appList = dataTable.ToList<AppInfo>();
            //appList.ForEach(c =>
            //    {
            //        Console.WriteLine(c.id);
            //    });
            //dataTable = appList.ToDataTable();
            //appList = dataTable.ToList<AppInfo>();

            //AppInfo model = new AppInfo();
            //model.Name = "ddd";
            //Reflector.SetPropertyValue(model, "Name", "yyy");
            //Console.Write(model.Name);

            //var repository = ConfigHelper.GetValue("Repository");
            //Console.Write(repository);

            //MyTextBox objTextBox = new MyTextBox();
            //Console.Write(objTextBox.ToHtmlString());

            //var list = _app.GetList();
            //var list = _app.GetLimitList(0,1);
            //var objDataTable = _app.GetLimitDataTable(0, 1);
            //var list = objDataTable.ToList<AppInfo>();
            //var list = _app.GetLimitDataSet(0, 1);
            //var list = _app.GetFields<long>("Id");

            //var list = _app.GetPageList(0, 10, "", "Id");
            //var list = _app.GetMyPageList(0, 10);

            //var list = _app.GetDataSet(0, 10);
            //log4net.Config.XmlConfigurator.Configure();
            //ILog log = log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
            //log4net.Config.XmlConfigurator.Configure();
            //log.Error("123");

            //List<Person> persons = new List<Person> 
            //{
            //    new Person{Age=18,Name="TJZH"},
            //    new Person{Age=17,Name="MM"}
            //};
            //var personss = persons.Where(c => c.Age == 19).Select(c => c.Name);



            Console.Read();

            //TestDB(new SqlParameter());
            //TestDB(new SqlParameter(), new SqlParameter());
            //TestDB(new SqlParameter[] { new SqlParameter(), new SqlParameter() });


            //BizAppInfo objBizAppInfo = new BizAppInfo();
            //objBizAppInfo.ExecuteTransation(() =>
            //    {
            //        AppInfo model = new AppInfo();
            //        model.GenerateNewIdentity();
            //        model.Name = "=test=";
            //        objBizAppInfo.Add(model);
            //        throw new Exception("d");
            //        model.Name = DateTime.Now.ToString("yyyyMMdd HH:mm:ss");
            //        objBizAppInfo.Update(model);
            //    }); 

            //BizAppInfo objBizAppInfo = new BizAppInfo("_Test");
            //var objList = objBizAppInfo.GetList();
            //var obj = objBizAppInfo.GetRecord(445280304821);
            //var field = objBizAppInfo.GetField("name", 445280304821);
            //var fields = objBizAppInfo.GetFields("name");
            //var fields = objBizAppInfo.GetFields(new string[] { "name", "id" });
            //var count = objBizAppInfo.GetTotal();
            //var max = objBizAppInfo.GetMax("id");
            //Console.WriteLine(max);
            #endregion

            #region 枚举测试
            //Type type = typeof(Weeks);
            //var strs = Enum.GetNames(type);//取枚举值(Moday)
            //foreach (var str in strs)
            //{
            //    Console.WriteLine(string.Format("Name:{0} Value:{1}", str, Convert.ToInt32(Enum.Parse(type, str))));//取枚举值(value)
            //    var attribute = type.GetField(str).GetCustomAttributes(typeof(DescriptionAttribute), false).FirstOrDefault() as DescriptionAttribute;
            //    Console.WriteLine(string.Format("Description:{0}", attribute.Description));
            //}

            //string days = "1,5,6,9";
            //Console.WriteLine(days.GetTexts<Weeks>());

            //string _days = "星期一,星期五";
            //Console.WriteLine(_days.GetValues<Weeks>());

            //int day = 5;
            //Console.WriteLine(day.GetText<Weeks>()); 
            #endregion

            //objGuidInfo = new GuidInfo();
            //objGuidInfo.GuidId = Guid.NewGuid();


            //List<Person> objList = new List<Person> 
            //{ 
            //    new Person
            //    {
            //        Name="a"
            //    },
            //    new Person
            //    {
            //        Name="b"
            //    },
            //    new Person
            //    {
            //        Name="c"
            //    },
            //    new Person
            //    {
            //        Name="d"
            //    },
            //    new Person
            //    {
            //        Name="e"
            //    }
            //};

            //var objList1 = objList.Skip(1).Take(3).ToList();
            //var objList2 = objList.Skip(2).Take(2).ToList();
            //var objList3 = objList.Skip(2).Take(2).ToList();
            //Console.WriteLine(object.ReferenceEquals(objList2, objList3));
            //Console.WriteLine(object.ReferenceEquals(objList2.Last(), objList3.Last()));
            //Console.WriteLine(object.ReferenceEquals(objList1.Last(), objList2.Last()));
            //Console.WriteLine(object.ReferenceEquals(objList2.Last().JsonSerialize().JsonDeserialize<Person>(), objList3.Last()));

            //Person objPerson = new Person();
            //objPerson.Name = "哈哈哈哈";
            //List<Person> objList = new List<Person> { objPerson };
            //Console.WriteLine(object.ReferenceEquals(objList.FirstOrDefault(), objList.FirstOrDefault()));
            //Console.WriteLine(object.ReferenceEquals(objList.Where(c => c.Name == "哈哈哈哈").ToList().FirstOrDefault(), objList.Where(c => c.Name == "哈哈哈哈").ToList()));

            //object o = null;
            //int i = (int)o;

            //string s1 = "";
            //bool isnull = s1 == null;
            //s1 = null;
            //Console.WriteLine(isnull);

            //BizCommentInfo objBizCommentInfo = new BizCommentInfo();
            //var commentId = objBizCommentInfo.GetField<object>("CommentId>@CommentId AND ObjectId=@ObjectId", "CommentId,ObjectId".CreateSqlParameters(1, 200), "top 1 CommentId");
            //var objList = objBizCommentInfo.GetFieldList<int>("", "top 10 CommentId");
            //var objList = objBizCommentInfo.GetList("", "", "top 10 CommentId,NickName");
            //var objList = objBizCommentInfo.GetList("", "", "*");
            Console.Read();

            //Console.WriteLine("*******************************************");

            //ThreadSleepTest();

            //Console.WriteLine("主线程休眠5s");
            //Thread.Sleep(5000);
            //Console.WriteLine("主线程醒来了");

            //ThreadUseAndConstruction();

            //Console.WriteLine("===========================================");

            //IPAddressInfo objIPAddressInfo = "116.231.139.115".GetIPAddressInfo();
            //Console.WriteLine(objIPAddressInfo.country + objIPAddressInfo.region + objIPAddressInfo.city);

            //List<string> strList = new List<string> { "value1", "value2" };
            //Func<string, bool> d = (s) => s == "value1";
            //Console.WriteLine(strList.Where(d).Count());
            //Expression<Func<string, bool>> objExpression = (s) => s == "value1";
            //Console.WriteLine(strList.AsQueryable().Where(objExpression).Count());

            //var objTuple = Tuple.Create<string, int>("abc", 5);
            //Console.WriteLine(objTuple.Item1);
            //Console.WriteLine(objTuple.Item2);
            //Console.WriteLine(objTuple.JsonSerialize());

            //ControlInfo objControlInfo = new ControlInfo();
            //objControlInfo.DisplayName = "配置信息";
            //objControlInfo.InitialControlInfo();
            //objControlInfo.Children = new List<ControlInfo>();

            //for (int i = 0; i < 3; i++)
            //{
            //    ControlInfo objControlInfoChild = new ControlInfo();
            //    objControlInfoChild.DisplayName = "配置信息" + i;
            //    objControlInfoChild.ControlType = "ControlType" + i;
            //    objControlInfoChild.DataType = "DataType" + i;
            //    objControlInfoChild.IsRequired = true;
            //    objControlInfoChild.Message = "Message" + i;
            //    objControlInfoChild.Regex = "Regex" + i;
            //    objControlInfoChild.Definition = "Definition" + i;
            //    objControlInfo.IsEditShow = true;
            //    objControlInfo.IsListShow = true;
            //    objControlInfo.Children.Add(objControlInfoChild);
            //}
            //objControlInfo.InitialControlInfo();
            //XmlSerializer serializer = new XmlSerializer(typeof(ControlInfo));
            //StringWriter sw = new StringWriter();
            //serializer.Serialize(sw, objControlInfo);
            //sw.Close();
            //string xml = sw.ToString();
            //Console.WriteLine(xml);
            //StringReader sr = new StringReader(xml);
            //ControlInfo objobjControlInfoDe = serializer.Deserialize(sr) as ControlInfo;

            //Console.WriteLine(objobjControlInfoDe.Children.Count());


            //var objPropertyList = typeof(ZooEntity).GetFieldList();
            //objPropertyList = typeof(ZooEntity).GetFieldList();

            //var objValidatorDict = typeof(ZooEntity).GetValidatorDict();
            //objValidatorDict = typeof(ZooEntity).GetValidatorDict();

            //object obj = 1;
            //Console.WriteLine(obj.ConvertTarget<int?>());

            //NullModel objNullModel1 = new NullModel
            //{
            //    Name = "tjzheng",
            //    Age = 25
            //};
            //NullModel objNullModel2 = new NullModel();
            //foreach (var objProperty in typeof(NullModel).GetProperties())
            //{
            //    //objProperty.SetValue(objNullModel2, objProperty.GetValue(objNullModel1));
            //    objProperty.SetValue(objNullModel2, null);
            //}
            //Console.WriteLine(objNullModel2.Age);

            //Type objType = typeof(int?);
            //bool isGeneral = objType.IsGenericType && objType.GetGenericTypeDefinition().Equals(typeof(Nullable<>));
            //Console.WriteLine(isGeneral);

            //object val = 1;
            //Console.WriteLine(Convert.ChangeType(val, typeof(int?)));

            //Console.WriteLine(typeof(int?));

            //CookieContainer objCookieContainer = new CookieContainer();
            //Cookie objCookie = new Cookie("EncryptTicket", "1C2AF4260B740B0799A5E67CE9BEFC0E6A5F13D2BB63C37C4C7F041B77D78859F574A007565F809646024B5414C694A680DC1E9392C6ED3203EA21F0C57A136D1714D6588E3060A6A73F413D849E848E103906A5A2B2C0BC7F46649E4AD1FA45304A3556089FF503FEBFB32D15CB56A481DBAE12D1E843CEE6F90EDDFEFCE32F671B87910AA9914EA7976E9C5826BCCCBF9642F77E8EB4C370DF438A4D1C79414496ACADB15ACCFEC2A1E705CF8672F0D101A75DC828C4A9D78BC1A163A9EB0C2ABA71E8FEABE9D31BEEFB1807F60510E4A4350FA32386783543FA4093B0CB06", "", "tjzheng.webapi.com");
            //objCookieContainer.Add(objCookie);
            //Console.WriteLine(HttpHelper.CreateHttpGet("http://tjzheng.webapi.com/security", null, objCookieContainer));

            //string test = "Http://192.168.1.137?d";
            //Console.WriteLine(test.IsURL());

            //TestDelegate testFunc = new TestDelegate(Test1);
            //testFunc += Test2;
            //testFunc("test1");

            //DateTime dt = DateTime.Now;
            //Console.WriteLine(dt.JsonSerialize());

            Console.Read();

        }
        static void Test1(string test1)
        {
            Console.Write(test1);
        }
        static void Test2(string test2)
        {
            Console.Write(test2);
        }

        static void TestDB(DbParameter DbPara)
        {
            SqlParameter sqlPara = (SqlParameter)DbPara;
            Console.WriteLine("成功");
        }
        static void TestDB(params DbParameter[] parameters)
        {
            //var sqlPara = parameters.Select(parameter => parameter as SqlParameter);
            //SqlParameter[] sqlPara = (SqlParameter[])parameters;
            Console.WriteLine("成功");
        }

        static T TryFunc<T>(Func<T> func)
        {
            T t = default(T);
            try
            {
                t = func();
            }
            catch
            {

            }
            return t;
        }

        static T ConverToTarget<T>(object value)
        {
            return (T)Convert.ChangeType(value, typeof(T));
        }

        static void TestNa()
        {
            string str = TestNameSpace.GetMethodInfo();
            Console.WriteLine(str);
        }
        //static void C()
        //{
        //    logger.Info("Info CCC");
        //}
        //static void B()
        //{
        //    logger.Trace("Trace BBB");
        //    logger.Debug("Debug BBB");
        //    logger.Info("Info BBB");
        //    C();
        //    logger.Warn("Warn BBB");
        //    logger.Error("Error BBB");
        //    logger.Fatal("Fatal BBB");
        //}
        //static void A()
        //{
        //    logger.Trace("Trace AAA");
        //    logger.Debug("Debug AAA");
        //    logger.Info("Info AAA");
        //    B();
        //    logger.Warn("Warn AAA");
        //    logger.Error("Error AAA");
        //    logger.Fatal("Fatal AAA");
        //} 

        static void NLogDBTest()
        {
            DatabaseTarget target = new DatabaseTarget();

            target.DBProvider = "mssql";
            target.DBHost = "TJZH-PC";
            target.DBUserName = "tjzheng";
            target.DBPassword = "5201314..";
            target.DBDatabase = "TjZheng_Logging";
            target.ConnectionString = EncryptConnectionHelper.ConnectionString("TjZheng.Logging");
            target.CommandText = "insert into Cms_LogTable_TB(LcId,LogName,ModuleType,LogType,ServerIP,ClientIP,UserName,LastRequestUrl,RequestUrl,LogTitle,LogContent,LogDate) values(@LcId, @LogName, @ModuleType, @LogType,@ServerIP,@ClientIP,@UserName,@LastRequestUrl,@RequestUrl,@LogTitle,@LogContent,@LogDate);";

            target.Parameters.Add(new DatabaseParameterInfo("@LcId", "${event-context:item=LcId}"));
            target.Parameters.Add(new DatabaseParameterInfo("@LogName", "${event-context:item=LogName}"));
            target.Parameters.Add(new DatabaseParameterInfo("@ModuleType", "${event-context:item=ModuleType}"));
            target.Parameters.Add(new DatabaseParameterInfo("@LogType", "${event-context:item=LogType}"));
            target.Parameters.Add(new DatabaseParameterInfo("@ServerIP", "${event-context:item=ServerIP}"));
            target.Parameters.Add(new DatabaseParameterInfo("@ClientIP", "${event-context:item=ClientIP}"));
            target.Parameters.Add(new DatabaseParameterInfo("@UserName", "${event-context:item=UserName}"));
            target.Parameters.Add(new DatabaseParameterInfo("@LastRequestUrl", "${event-context:item=LastRequestUrl}"));
            target.Parameters.Add(new DatabaseParameterInfo("@RequestUrl", "${event-context:item=RequestUrl}"));
            target.Parameters.Add(new DatabaseParameterInfo("@LogTitle", "${message}"));
            target.Parameters.Add(new DatabaseParameterInfo("@LogContent", "${event-context:item=LogContent}"));
            target.Parameters.Add(new DatabaseParameterInfo("@LogDate", "${event-context:item=LogDate}"));

            //param = new DatabaseParameterInfo();
            //param.Name = "@time_stamp";
            //param.Layout = "${date}";
            //target.Parameters.Add(param);

            //param = new DatabaseParameterInfo();
            //param.Name = "@level";
            //param.Layout = "${level}";
            //target.Parameters.Add(param);

            //param = new DatabaseParameterInfo();
            //param.Name = "@logger";
            ////param.Layout = "${logger}";
            //param.Layout = "${event-context:item=LogName}";
            //target.Parameters.Add(param);

            //param = new DatabaseParameterInfo();
            //param.Name = "@message";
            //param.Layout = "${message}";
            //target.Parameters.Add(param);

            ////NLog.Config.SimpleConfigurator.ConfigureForTargetLogging(target, LogLevel.Debug);
            LoggingConfiguration config = new LoggingConfiguration();
            config.AddTarget("database", target);
            LoggingRule rule3 = new LoggingRule("*", LogLevel.Debug, target);
            config.LoggingRules.Add(rule3);
            LogManager.Configuration = config;
            Logger logger = LogManager.GetLogger("Example");

            LogEventInfo ei = new LogEventInfo(LogLevel.Info, "", "log message");
            ei.Properties["LcId"] = 0;
            ei.Properties["LogName"] = "LogName";
            ei.Properties["ModuleType"] = "ModuleType";
            ei.Properties["LogType"] = "LogType";

            ei.Properties["ServerIP"] = "127.0.0.1";
            ei.Properties["ClientIP"] = "127.0.0.1";
            ei.Properties["UserName"] = "tjzheng";
            ei.Properties["LastRequestUrl"] = "http://www.baidu.com/";

            ei.Properties["RequestUrl"] = "http://www.cms.com/";
            ei.Properties["LogContent"] = "测试内容啊";
            ei.Properties["LogDate"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            logger.Log(ei);

            //logger.Debug("log message");
        }


        static void TestGoTo()
        {
            int x = 200, y = 4;
            int count = 0;
            string[,] array = new string[x, y];

            // Initialize the array:
            for (int i = 0; i < x; i++)

                for (int j = 0; j < y; j++)
                    array[i, j] = (++count).ToString();

            // Read input:
            Console.Write("Enter the number to search for: ");

            // Input a string:
            string myNumber = Console.ReadLine();

            // Search:
            for (int i = 0; i < x; i++)
            {
                for (int j = 0; j < y; j++)
                {
                    if (array[i, j].Equals(myNumber))
                    {
                        goto Found;
                    }
                }
            }

        GotoTest:
            Console.WriteLine("GotoTest");

            Console.WriteLine("The number {0} was not found.", myNumber);
            goto Finish;

        Found:
            Console.WriteLine("The number {0} is found.", myNumber);
        Finish:
            Console.WriteLine("End of search.");
        }

        public static void ThreadUseAndConstruction()
        {
            ThreadPool.SetMinThreads(5, 5); // set min thread to 5
            ThreadPool.SetMaxThreads(12, 12); // set max thread to 12

            Stopwatch watch = new Stopwatch();
            watch.Start();

            WaitCallback callback = index =>
            {
                Console.WriteLine(String.Format("{0}: Task {1} started 运行时间：{2}", watch.Elapsed, index, DateTime.Now.ToString("yyyy-MM-dd HH：mm：ss：ffff")));
                Thread.Sleep(10000);
                Console.WriteLine(String.Format("{0}: Task {1} finished 结束时间：{2}", watch.Elapsed, index, DateTime.Now.ToString("yyyy-MM-dd HH：mm：ss：ffff")));
            };

            for (int i = 0; i < 20; i++)
            {
                ThreadPool.QueueUserWorkItem(callback, i);
            }
        }

        public static void ThreadSleepTest()
        {
            Thread objThread = new Thread(new ThreadStart(() =>
            {
                Console.WriteLine("我要休眠5s");
                Thread.Sleep(5000);
                Console.WriteLine("我重新启动了");
            }));
            objThread.Start();
        }

        static void TestDomainPath()
        {
            //        // 获取程序的基目录。
            Console.WriteLine("获取程序的基目录：" + System.AppDomain.CurrentDomain.BaseDirectory);

            //// 获取模块的完整路径，包含文件名
            Console.WriteLine("获取模块的完整路径，包含文件名：" + System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName);

            //// 获取和设置当前目录(该进程从中启动的目录)的完全限定目录。
            Console.WriteLine("获取和设置当前目录(该进程从中启动的目录)的完全限定目录：" + System.Environment.CurrentDirectory);

            //// 获取应用程序的当前工作目录，注意工作目录是可以改变的，而不限定在程序所在目录。
            Console.WriteLine("获取应用程序的当前工作目录，注意工作目录是可以改变的，而不限定在程序所在目录：" + System.IO.Directory.GetCurrentDirectory());

            //// 获取和设置包括该应用程序的目录的名称。
            Console.WriteLine("获取和设置包括该应用程序的目录的名称：" + System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase);

            ////// 获取启动了应用程序的可执行文件的路径。
            //Console.WriteLine(System.Windows.Forms.Application.StartupPath);

            ////// 获取启动了应用程序的可执行文件的路径及文件名
            //Console.WriteLine(System.Windows.Forms.Application.ExecutablePath);
        }

        static void TestHttp()
        {
            Console.WriteLine("异步Http请求测试Start");
            //Console.WriteLine("http://tjzheng.news.com/news/test".CreateHttpGet());
            Console.WriteLine("http://tjzheng.news.com/news/test".CreateHttpGetAsync().Result);
            Console.WriteLine("异步Http请求测试End");
        }
        static async void TestHttpAsync()
        {
            Console.WriteLine("异步Http请求测试Start");
            //Console.WriteLine("http://tjzheng.news.com/news/test".CreateHttpGet());

            //string result = await "http://www.gao7.com".CreateHttpGetAsync();
            //string result = await "http://tjzheng.news.com/news/test".CreateHttpGetAsync();

            //var result = "http://tjzheng.news.com/news/test".CreateHttpGetAsync();
            //Thread.Sleep(5 * 1000);
            //Console.WriteLine(result.Result);
            //Console.WriteLine(result.Result);

            //string result = await "http://tjzheng.news.com/news/test".CreateHttpGetAsync();
            //Thread.Sleep(5 * 1000);
            //Console.WriteLine(result);


            //var objRequest = "http://tjzheng.news.com/news/test".CreateHttpRequest();
            //var objResponse = await objRequest.GetResponseAsync();

            //ThreadPool.QueueUserWorkItem((state) => { Console.WriteLine("http://tjzheng.news.com/news/test".CreateHttpGet()); });

            Console.WriteLine("异步Http请求测试End");
            //Console.WriteLine();

        }
    }

    delegate void TestDelegate(string test);

    enum Weeks : int
    {
        [Description("星期一")]
        Monday = 1,
        [Description("星期五")]
        Friday = 5
    }

    class Person
    {
        public Person()
        {
            //Console.WriteLine("实例化一个Person");
        }
        public Person PersonChild { get; set; }
        public int Age { get; set; }
        public string Name { get; set; }
        protected string _name { get; set; }
        public object Data { get; set; }
    }
    class Chinese : Person
    {
        public string ChineseName { get; set; }
    }

    public class SoftrCategoriesExt : SoftrCategories
    {

    }

    public class SoftrCategories
    {

    }

    public class FooEntity
    {
        public string foo { get; set; }
        public string zoo { get; set; }
        public string bar { get; set; }
        public string baz { get; set; }
        public ZooEntity zooEntity { get; set; }
    }

    public class ZooEntity
    {
        [NonDBField]
        public string zoo { get; set; }
        [Validator(IsRequired = true)]
        public string bar { get; set; }
        public string baz { get; set; }
    }

    public static class ArticleInfoHelper
    {
        public static string CreateTagCondition(this string Tags)
        {
            var objTags = Tags.Split(',');
            var objSysTags = objTags.Select(c => string.Format("SysTag:\"{0}\"", c)).Aggregate((x, y) => x + " OR " + y);
            var objArticleTags = objTags.Select(c => string.Format("ArticleTag:\"{0}\"", c)).Aggregate((x, y) => x + " OR " + y);
            return string.Concat(objSysTags, " OR ", objArticleTags);
        }
    }

    public class TestNameSpace
    {
        public static string GetMethodInfo()
        {
            string str = "";
            //取得当前方法命名空间
            str += "命名空间名:" + MethodBase.GetCurrentMethod().DeclaringType.Namespace + "\n";
            //取得当前方法类全名 包括命名空间
            str += "类名:" + MethodBase.GetCurrentMethod().DeclaringType.FullName + "\n";
            //取得当前方法名
            str += "方法名:" + MethodBase.GetCurrentMethod().Name + "\n";
            str += "\n";

            StackTrace ss = new StackTrace(true);
            MethodBase mb = ss.GetFrame(1).GetMethod();
            //取得父方法命名空间
            str += mb.DeclaringType.Namespace + "\n";
            //取得父方法类名
            str += mb.DeclaringType.Name + "\n";
            //取得父方法类全名
            str += mb.DeclaringType.FullName + "\n";
            //取得父方法名
            str += mb.Name + "\n";
            return str;
        }
    }

    public abstract class TestAbstract
    {
        public TestAbstract()
        {
            Console.WriteLine("TestAbstract");
        }
        public TestAbstract(string result)
        {
            Console.WriteLine(result);
        }
        //public static void Test()
        //{
        //    Console.WriteLine("TestAbstract");
        //}
    }
    public class TestAbstractChild : TestAbstract
    {
        public TestAbstractChild()
            : base()
        {
        }
        public TestAbstractChild(string result)
            : base(result)
        {
        }
    }
    /// <summary>
    /// 非数据库字段特性标识
    /// </summary>
     [AttributeUsage(AttributeTargets.Property | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
    public class NonDBFieldAttribute : Attribute
    {
    }

    public class NullModel
    {
        [NonDBField]
        [NonDBField]
        public string Name { get; set; }
        public int? Age { get; set; }
    }
}
